package main

var stack1 []int
var stack2 []int

func main() {

}

func Push(node int) {
	stack1 = append(stack1, node)

}

func Pop() int {
	l := len(stack2)
	if l > 0 {
		v := stack2[l-1]
		stack2 = stack2[:l-1]
		return v
	}

	l = len(stack1)
	for l > 0 {
		if l == 1 {
			v := stack1[0]
			stack1 = []int{}
			return v

		}
		stack2 = append(stack2, stack1[l-1])
		stack1 = stack1[:l-1]
		l = l - 1
	}
	return 0
}
